<?php
namespace Wx\Controller;
use Think\Controller;
class FarmerController extends CommonController {

    public function index(){
		$member=D('member');
		$member_farmers=D('member_farmers');
		//更新
		if($_POST){
			$data['info']=$_POST['info'];
			$data['serve']=$_POST['serve'];
			$alt=$member_farmers->where("u_id=".session('u_id'))->save($data);
			$this->redirect('/Wx/User/farmers'); 		
		}//end if
		$getinfo=$member->where("id=".session('u_id'))->find();
		$this->assign('getinfo',$getinfo);
		
		$getfarm=$member_farmers->where("u_id=".session('u_id'))->find();
		$area=D('area');
		$getarea=$area->where("id=".$getfarm['a_id_1'])->find();
		$getfarm['a1']=$getarea['name'];
		$getarea=$area->where("id=".$getfarm['a_id_2'])->find();
		$getfarm['a2']=$getarea['name'];
		$getarea=$area->where("id=".$getfarm['a_id_3'])->find();
		$getfarm['a3']=$getarea['name'];
		$getarea=$area->where("id=".$getfarm['a_id_4'])->find();
		$getfarm['a4']=$getarea['name'];
		$getarea=$area->where("id=".$getfarm['a_id_5'])->find();
		$getfarm['a5']=$getarea['name'];
		$this->assign('getfarm',$getfarm);
		
        $this->display("information-nh");
    }//end fun
}